import 'package:flutter/material.dart';
import 'package:flutter_ahj_app/app/pctask/PcrwViewModel.dart';
import 'package:flutter_ahj_app/app/pctask/pcrwList/PCTask_list_view.dart';
import 'package:flutter_ahj_app/app/yhpc/YhpcViewModel.dart';
import 'package:flutter_ahj_app/base/basewidget/view/BaseWidget.dart';
import 'package:flutter_ahj_app/base/basewidget/viewmodel/ViewModelProvider.dart';
import 'package:flutter_ahj_app/base/utils/JUIKit/JText.dart';
import 'package:flutter_ahj_app/base/utils/mTopBar.dart';
import 'package:flutter_ahj_app/base/values/SQColor.dart';
import 'package:flutter_ahj_app/base/values/dimens.dart';

 class PcrwView extends BaseStatefulWidget {
  @override
  State<StatefulWidget> initState() {
    // TODO: implement initState
    // throw UnimplementedError();
    return PcrwViewState();
  }
}

class PcrwViewState extends State<PcrwView> with TickerProviderStateMixin {

  TabController  _tabCtr ;

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: MTopBar(
        elevation: 0,
          title: '排查任务',
          bottom: TabBar(
            controller: _tabCtr,
            isScrollable: false,
            indicatorColor: SQColor.white,
            indicatorWeight: 2,

            indicatorPadding: EdgeInsets.only(bottom: 0),
            labelColor: SQColor.white,
            labelStyle: TextStyle(
              fontSize: Dimens.textSize32,
            ),
            unselectedLabelColor: SQColor.per70White,
            unselectedLabelStyle: TextStyle(
              fontSize: Dimens.textSize28,
            ),
            tabs: [
              Tab(text: '待我处理的'),
              Tab(text: '我发起的'),
            ],
          ))
          .create(),
      body: _bodyView(controller: _tabCtr),
    );
  }

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    _tabCtr = TabController(
      length: 2,
      vsync: this,
    );
  }

  _bodyView({TabController controller}) {
    return TabBarView(controller: controller, children: [
      ViewModelProvider(
          viewModel: PcrwViewModel(),
          child: PCTask_list_view(pageType: PcTaskPageType.dwcl)),
      ViewModelProvider(
          viewModel: PcrwViewModel(),
          child: PCTask_list_view(pageType: PcTaskPageType.wfq)),
    ]);
  }

}
